﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xml;
using Microsoft.Phone.Tasks;
using Common.Library;
using OnlineVideos.UI;

namespace Common.Utilities
{
    public class UtilitiesManager
    {
        public static void LoadBrowserTaskToSocialNetwork(string url)
        {
            try
            {
                WebBrowserTask webBrowserTask = new WebBrowserTask();
                webBrowserTask.Uri = new Uri(url, UriKind.Absolute);
                webBrowserTask.Show();
            }
            catch (Exception ex)
            {
                //Exceptions.SaveOrSendExceptions("Exception in LoadBrowserTsk Method In AboutUs.Xaml.cs file.", ex);
            }
        }

        public static void ShowMarketplaceAppReviewTask()
        {
            try
            {
                //rate this app
                MarketplaceReviewTask marketplaceReviewTask = new MarketplaceReviewTask();
                marketplaceReviewTask.Show();
            }
            catch (Exception ex)
            {
                //  Exceptions.SaveOrSendExceptions("Exception in ShowMarketplaceAppReviewTask Method In PhoneHelper.cs file.", ex);
            }
        }
        public static void LoadBrowserTask(string url)
        {
            try
            {
                Deployment.Current.Dispatcher.BeginInvoke(delegate()
                      {
                          PageHelper.NavigateTo(NavigationHelper.youtubeBrowserPage(url));
                      });
            }
            catch (Exception ex)
            {
                Exceptions.SaveOrSendExceptions("Exception in LoadBrowserTsk Method In AboutUs.Xaml.cs file.", ex);
            }
        }
        public static void ShareWithFriendsComposeEmailTask()
        {
            try
            {
                //share this app
                EmailComposeTask ComposeEmail = new EmailComposeTask();
                ComposeEmail.To = "";
                ComposeEmail.Subject = UtilitiesResources.ProjectName + " App";
                string lnk = "I have recently found a very good entertainment app that I would like to share with you, Get the app at ";
                lnk += UtilitiesResources.AppMarketplaceWebUrl + UtilitiesResources.ApplicationProductID;
                ComposeEmail.Body = lnk;
                ComposeEmail.Show();
            }
            catch (Exception ex)
            {
                // Exceptions.SaveOrSendExceptions("Exception in ShareWithFriendsComposeEmailTask Method In PhoneHelper.cs file.", ex);
            }
        }

        public static void LaunchMarketplaceSearchTask()
        {
            try
            {
                //related apps
                MarketplaceSearchTask marketplaceSearchTask = new MarketplaceSearchTask();
                marketplaceSearchTask.SearchTerms = "LART SOFT";
                marketplaceSearchTask.Show();
            }
            catch (Exception ex)
            {
                //  Exceptions.SaveOrSendExceptions("Exception in LaunchMarketplaceSearchTask Method In PhoneHelper.cs file.", ex);
            }
        }
       
    }
}
